package com.lagou.mapper;

import com.lagou.domain.Novel;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface NovelMapper {

    /**
     * 新增小说
     * @param novel
     */
    @Insert("insert into novel(title,author,pic,content) values ( #{title}, #{author}, #{pic}, #{content})")
    void addNovel(Novel novel);

    /**
     * 查询所有小说
     * @return
     */
    @Select("select * from novel  where id = #{id}")
    List<Novel> getAll(@Param("id") Long id);
}
